The present invention relates to methods and apparatus for clipping polygons against a viewing volume for a 3-D graphics display system.
Three-dimensional computer graphics displays are used to display images to a user as if he were observing a real world environment. These systems store in a data base a representation in three dimensional coordinates of three-dimensional objects, as well as their color and other properties. Additional "environment" information including the number, color, location, and other properties of illumination sources, atmospheric properties, and many other details may also be specified. The display is produced after being provided with the desired viewing angle for the viewer. The system must calculate all the details of the image, including determining which objects obscure others from the viewer's point of view, and present them accordingly.
A typical graphics display system is shown in FIG. 1. An image data base 12 stores a description of the objects in the scene. The objects are described with a number of small polygons which cover the surface of the object in the same manner that a number of small tiles can cover a wall or other surface. Each polygon is described as a list of vertex coordinates (X, Y, Z in "Model" coordinates) and some specification of material surface properties (i.e., color, texture, shininess, etc.), as well as possibly the normal vectors to the surface at each vertex. For three-dimensional objects with complex curved surfaces, the polygons in general must be triangles or quadralaterals, and the latter can always be decomposed into pairs of triangles.
A transformation engine 14 transforms the object coordinates in response to the angle of viewing selected by a user from user input 16. In addition, the user may specify the field of view, the size of the image to be produced, and the back end of the viewing volume so as to include or eliminate background as desired.
Once this viewing area has been selected, a clipping circuit 18 eliminates the polygons (i.e., triangles) which are outside the viewing area and "clips" the polygons which are partly inside and partly outside the viewing area. These clipped polygons will correspond to the portion of the polygon inside the viewing area with new edge(s) corresponding to the edge(s) of the viewing area. The polygon vertices are then transmitted to the next stage in coordinates corresponding to the viewing screen (in X, Y coordinates) with an associated depth for each vertex (the Z coordinate). In a typical system, the lighting model 20 is next applied taking into account the light sources 22. The polygons with their color values are then transmitted to a rasterizer 24.
For each polygon, rasterizer 24 determines which pixel positions are covered by the polygon and attempts to write the associated color values and depth (Z value) into frame buffer 26. Rasterizer 24 compares the depth values (Z) for the polygon being processed with the depth value of a pixel which may already be written into the frame buffer. If the depth value of the new polygon pixel is smaller, indicating that it is in front of the polygon already written into the frame buffer, then its value will replace the value in the frame buffer because the new polygon will obscure the polygon previously processed and written into the frame buffer. This process is repeated until all of the polygons have been rasterized. At that point, video controller 28 displays the contents of frame buffer 26 on a display 30 a scan line at a time in raster order.
The viewing area 32 which a user may select with user input 16 is shown in FIG. 2. A front viewing plane 34 basically shows the position of the display screen in the three-dimensional space with a back plane 36 defining the back of the viewing volume. Front viewing plane 34 can be thought of as similar to the viewfinder on a camera which a user looks through as he walks around a scene trying to select the viewing angle he wants or moves forward to get a closer look. The clipping of a triangle 38 with viewing area 32 is shown. Triangle 38 represents one portion of the surface of an object in a three-dimensional scene which has a tip area 40 which extends into the viewing volume. When clipping is done, only this tip portion is retained and a new triangle is formed having a bottom edge corresponding to a line in the bottom plane of viewing area 32 which cuts through triangle 38. See, for instance, U.S. Pat. No. 3,816,126.